<?php 

session_start();
require_once('../config.php');
require_once('lib/sitemaplib.php');

ini_set('display_errors', true);
ini_set('display_startup_errors', true);
error_reporting(E_ALL);

$timestart = time();

foreach ($CONFIG->availablelanguages as $lang) {
	
	$_SESSION['lang'] = $lang;
    $DB_LANG = new DB_lang();

    $labels = getLabelsCloud(true);
    
    $sql = "DELETE FROM morelabeleds WHERE 1";
    $DB_LANG->executeSql($sql);
    
    if (!$labels) {
    	echo $lang.' no té labels!<br/>';
    	continue;
    }
    
    foreach ($labels as $label => $count) {
    	$DB_LANG->executeSql("INSERT INTO morelabeleds (label, count) VALUES ('$label', '$count')");
    }
}

